home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / c / cnews004.zip / CNEWS004.NWS next >
Text File  |  1988-02-21  |  60KB  |  1,484 lines

  1.      Volume 1, Number  4                             21 February  1988
  2.      +---------------------------------------------------------------+
  3.      |                                                               |
  4.      |                       -  C   News  -                          |
  5.      |                                                               |
  6.      |                        International                          |
  7.      |                C Programming & Compiler Review                |
  8.      |                         Newsletter                            |
  9.      |                                                               |
  10.      +---------------------------------------------------------------+
  11.      US Office:
  12.      Editor at large                                       Barry Lynch
  13.      Assistant Editor                                      Ami Dworkin
  14.      Technical Editor                                Marshall Presnell
  15.  
  16.      Australian Office:     
  17.      Editor                                               David Nugent
  18.  
  19.      C News  is  published  bi-weekly by  the  C BBS as its official
  20.      newsletter.  You are encouraged to submit articles for publication
  21.      in C News.  Articles should be related to C programming and can be
  22.      Tutorials, reviews or articles of interest to the C programming
  23.      community.  All Operating systems are fairly represented and this
  24.      newsletter shows no favoritism to any one in particular.  Instruct-
  25.      ions on how to submit articles for publication is included on the
  26.      last page. 
  27.           
  28.      C News is the property of the C BBS and is Copyright 1988 by the
  29.      the C BBS.  All rights are reserved and distribution is limited to
  30.      electronic distribution and personal printed copies.  C News cannot
  31.      be resold at any profit, by any organization.  All material enclosed
  32.      within the newsletter is the opinions of the writers and not the
  33.      C BBS or it's Sysop. 
  34.  
  35.      DISTRIBUTION POINTS:
  36.  
  37.  
  38.      EASTERN US - C BBS 109/713   (703)998-8377
  39.      
  40.      CANADA     - Another BBS 
  41.      AUSTRALIA  - Alpha Centuri BBS
  42.      EUROPE     - 150/1 - Sysop: Henk Wevers
  43.  
  44.      New distribution points are always welcome, if you are interested
  45.      send me a netmail message at the above address.
  46.  
  47.      
  48.      C News 1-04                                          21 Feb 1988
  49.  
  50.      =================================================================
  51.                              TABLE OF CONTENTS
  52.      =================================================================
  53.      
  54.  
  55.      1. EDITORIAL 
  56.              The Heap: messages from the editor....................  1
  57.              New Column, User requests
  58.  
  59.      2. PATCHES/MITE REPORTS
  60.         MSC Version 5.0 Bug Listings  .............................  2
  61.  
  62.      3. SHORT SNIPS  
  63.         Magazine Review's
  64.             by Barry Lynch   ......................................  6
  65.  
  66.      4. BOOK REVIEWS
  67.         MS-DOS Developer's Guide   ................................  7
  68.             by Barry Lynch
  69.         
  70.      5. SOFTWARE REVIEWS
  71.         Public Domain:   ..........................................  8
  72.         SETPRGMS.ARC, SHIFT_C.ARC, SYSACT11.ARC, XENIXARC.ARC,
  73.         CDATE.ARC, C_DATES.ARC, C-SUBR.ARC, JCL-SRC.ARC, and
  74.         NDMAKE41.ARC
  75.            by David Nugent
  76.  
  77.      6. FEATURE ARTICLE
  78.         Filename Wildcard Expansion in Microsoft C  ............... 15
  79.  
  80.      7. /Usr/Bin
  81.            by Marshall Presnell   ................................. 26
  82.  
  83.      8. NOTES
  84.         Article Submission Standards  ............................. 28
  85.         Address's   ............................................... 29
  86.         USER Response Form  ....................................... 30
  87.     
  88.      9. INDEX   ................................................... 31
  89.  
  90.  
  91.  
  92.      C News 1-04                 Page 1                   21 Feb 1988
  93.  
  94.      =================================================================
  95.                                  EDITORIAL
  96.      =================================================================
  97.  
  98.      The HEAP: Messages from the Editor.
  99.  
  100.  
  101.           With this issue of C News we start a new column, and begin
  102.      <hopefully> a new tradition.  First, Marshall Presnell joins us
  103.      with his column the "/usr/bin".  Dedicated to technical questions
  104.      and answers relating to C programming.  Marshall has a BS in
  105.      Electrical Engineering and is quite a accomplished programmer in
  106.      C and ASM.  Marshall's column will be a regular feature, and I 
  107.      know that he will provide a valuable service to all of us in the
  108.      future.
  109.  
  110.           The next feature of C News that I am proud of, and hope becomes
  111.      a regular feature.  Is an article by Bill Mayne on Expanding
  112.      arguments from the command line and some other goodies.  Mr. Mayne
  113.      has done an excellent job and should be congratulated by all.  It
  114.      is hoped that articles like his will be forthcoming in future issues
  115.      of C News as well.
  116.  
  117.           Last Issue, I included a user response form for users to fill
  118.      and send back if they had the chance.  Well, quite a few users did
  119.      and I thank you for the support.  Most of the suggestions dealt
  120.      with more beginner oriented tutorials and a technical question
  121.      and answer column.  Both of these requests have been satisfied
  122.      in this issue, and we will attempt to keep up the quality of work
  123.      that we have been able to produce for this issue in future issues.
  124.  
  125.      
  126.       B C'ng U
  127.  
  128.       Barry Lynch
  129.  
  130.  
  131.                          
  132.           C News 1-04                 Page 2                   21 Feb 1988
  133.  
  134.      =================================================================
  135.                           PATCHES/MITE REPORTS
  136.      =================================================================
  137.  
  138.      MSC Version 5.0
  139.  
  140.   Be VERY careful when using the MSC5 compiler. The optimizer is
  141. generating a LOT of bad code in places. In some cases you can disable
  142. enough of the optimizer to force it to generate good code, but in
  143. other cases one must simply rewrite code to trick the compiler into
  144. doing the write thing. The problems appear to be with large memory
  145. models. All C code was compiler with "Alfu" memory model.
  146.  
  147.     In the next two messages I will show two code samples that
  148. generated bad code. The samples are simplified extracts that
  149. demonstrate a compiler bug..
  150.  
  151.    This demonstrates a bug in the loop optimizer. The cast to a CHAR *
  152. is what confused the optimizer... The code is large memory model
  153. compiled with "Alfu". The bug is correctable by disabling the loop
  154. optimizer.
  155.  
  156. #include<stdio.h>
  157.  
  158.  
  159. #define GETSEGPTR(xseg,xoff) ((char *) (((long) xseg <<16) | xoff))
  160. #define WHATEVER 20
  161.  
  162. void
  163. fortran
  164. badcode(buffer,unpointer)
  165. char *buffer;
  166. unsigned *unpointer;
  167. {
  168.         char *ptr;
  169.         unsigned segval, get_a_segval();
  170.         int i;
  171.  
  172.         segval=get_a_segval();
  173.  
  174.         for(i=0; i< WHATEVER ; i++)
  175.         {
  176.            do_something( GETSEGPTR(segval,0));
  177.            segval+=16;
  178.         }
  179. }
  180.  
  181.  
  182.     It does not matter what the called routines do, The compiler does
  183. not generate the code to add 16 (seg size) to the variable SEGVAL..
  184. Below is the asm that the compiler generates....
  185.  
  186. C News 1-04                 Page 3                   21 Feb 1988
  187.  
  188. =================================================================
  189.                       PATCHES/MITE REPORTS
  190. =================================================================
  191.  
  192. MSC Version 5.0
  193.  
  194. *** 000024      be 14 00        mov     si,20
  195. *** 000027      81 46 fe 40 01  add     WORD PTR [bp-2],320    
  196. ;segval
  197.                                         $L20000:
  198.         ;|***         {
  199.         ; Line 20
  200.         ;|***            do_something(GETSEGPTR(segval,0));
  201.         ; Line 21
  202. *** 00002c      ff 76 f6        push    WORD PTR [bp-10]
  203. *** 00002f      ff 76 f4        push    WORD PTR [bp-12]
  204. *** 000032      9a 00  call    FAR PTR _do_something
  205. *** 000037      83 c4 04        add     sp,4
  206.         ;|***            segval+=16;
  207.